package com.cskaoyan.charstream.transfer.outs;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;

/*
         接下来，我们利用Writer向文本中写入中文字符串。
         但是考虑到Writer是抽象类，无法直接实例化，于是我们使用其子类OutputStreamWriter。

         OutputStreamWriter 是字符流通向字节流的桥梁

      // 接收一个字节输出流对象，创建出一个基于默认字符集转化字符输出流对象
       public OutputStreamWriter(OutputStream out)

      // 接收一个字节输出流对象，创建出一个基于指定字符集的转化字符输出流对象
      // 字节流 + 编码表
      public OutputStreamWriter(OutputStream out, String charsetName)
 */
public class Demo1Constructor {

    public static void main(String[] args) throws FileNotFoundException {

        //FileOutputStream firstFos = new FileOutputStream("b.txt");
        //  public OutputStreamWriter(OutputStream out)
        //Writer firstWriter = new OutputStreamWriter(firstFos);

        // public OutputStreamWriter(OutputStream out, String charsetName)
        FileOutputStream secondFos = new FileOutputStream("c.txt");
        Writer secondWriter = new OutputStreamWriter(secondFos);


    }
}
